There are 2 types of SDK events: normal notification events and exception alarm events.
The normal notification events are sent when frame grabbers or cameras are in normal condition. Based on event generation conditions, operations to report events vary.
Some events are only triggered when cameras or cameras connected to frame grabbers start grabbing images. To report these events to the program, you should first subscribe to and enable the specified events, and call MV_CC_StartGrabbing() to start grabbing images.
Other events can be reported to the program without grabbing images. To report these events to the program, you should subscribe to and enable the specified events.
The exception alarm events are sent when errors occur in the SDK and can be acquired directly from the SDK. These events are to notify users of exceptions during frame grabber or camera running (e.g., camera offline) so that users can perform troubleshooting in time.
When cameras or frame grabbers are turned on, custom exception alarm event processing function can be registered. After registration, when exception alarm is generated, the device will automatically execute custom exception alarm processing function.
Subscribe to Event: Call MV_CC_RegisterEventCallBackEx() to subscribe to a specified event. Pass the event name strEventName when calling this API.
Enable Event: Call MV_CC_EventNotificationOn() to enable the specified event.
Get Event: When the frame grabber or camera generates an event, the SDK will trigger the corresponding event callback function and push the event information to users. The pushed event information usually contains key information such as the event name, event ID, and timestamp, but not necessarily others such as frame No. and event data. Information contained in different events might vary, and the actual condition shall prevail.
Close Event: Call MV_CC_EventNotificationOff() to close the specified event.
Unsubscribe from Event: Call MV_CC_RegisterEventCallBackEx() to unsubscribe from the event. Pass the event name strEventName when calling this API, and set the event callback pointer cbEvent to NULL. After a successful calling, you can unsubscribe from the specified event.
Register Event: Call MV_CC_RegisterExceptionCallBack() to register exception event. Exception will be reported to SDK.
Get Event: When exception occurs in SDK, exception callback function will be triggered, pushing exception alarm event to the user.
Unregister from Event: Call MV_CC_RegisterExceptionCallBack() to unregister from exception alarm event. When exception callback function is NULL, you can unsubscribe from the exception alarm event of frame grabbers or the camera instance.
The following sample codes show how to subscribe to, handle, and unsubscribe from exception alarm event.